
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../vue-2.4.0.js" ></script>
    <!-- <script src="../vue1026.js" ></script> -->
</head>

<style>

    #tab{
        width:800px;
        border-collapse: collapse;
        margin: 20px auto;
    }
    #tab th{
        background-color: #0094ff;
        color: white;
        border: solid  black 2px;
        text-align: center;
    }

    #tab td{
        border: solid  black 2px;
        text-align: center;
    }

    

</style>
<body>
       
    <div id="app">
        {{ time }} <br>
           {{ time|datefmt}}
    </div>
</body>

<script>
    var vm = new Vue({
        el:'#app',
        data:{
           
            time:new Date()

        },
        // 私有过滤器
        filters:{
            datefmt:function(input){
                var res = '';
                var year = input.getFullYear();
                var month = input.getMonth()+1;
                var day = input.getDate();
                res = year + '-'+ month + '-' + day
                return res;
            }
        }
    });

</script>
</html>
